import requests

url = 'http://xxx.com/'
file_path = './file.txt'

# 读取文件
with open(file_path, 'rb') as file:
    # 将读取的二进制信息赋值为字典
    files = {'file': file}
    # 通过字典发送post请求
    response = requests.post(url, files=files)

# 获取响应信息
print(response.text)